package com.gopay.common.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class GetKeyProperties {

    private static Log logger = LogFactory.getLog(GetKeyProperties.class);

    private static Properties proConfig = null;

    static {
        InputStream inputstream = GetKeyProperties.class.getClassLoader().getResourceAsStream("keyStore.properties");
        proConfig = new Properties();
        try {
            proConfig.load(inputstream);
            inputstream.close();
        } catch (IOException e) {
            logger.error("No keyStore.properties defined error", e);
        }
    }

    // 根据key读取value
    public static String getValueBykey(String key) {
        try {
            String value = proConfig.getProperty(key);
            return value;
        } catch (Exception e) {
            e.printStackTrace();
            logger.error("ConfigInfoError", e);
            return null;
        }
    }
    public static void main(String args[]){
        GetKeyProperties.getValueBykey("public_key_store");
    }
    

}
